

<template>
  <div class="user-box">
    <s-header :name="'我的'"></s-header>
      <div class="user-info" :style="{backgroundImage: `url(${background_image})`}">
        <div class="user_avatar">
          <img src="../assets/avatar_default.png" alt="头像" width="60" height="60" >
        </div>
        <div class="user_name">{{ user.nickName }}</div>
      <div class="info">
        <div class="user-desc">
          <span>账号：{{ user.loginName }}</span>
          <span class="name">个人简介：{{ user.introduceSign }}</span>
        </div>
      </div>
    </div>
    <ul class="user-list">
      <li @click="goTo('setting')">
        <span>账号管理</span>
        <van-icon name="arrow"  />
      </li>
      <li @click="goTo('order')">
        <span>我的订单记录</span>
        <van-icon name="arrow" />
      </li>
      <li @click="goTo('address?from=mine')">
        <span>收货地址管理</span>
        <van-icon name="arrow" />
      </li>
    </ul>
    <nav-bar></nav-bar>
  </div>
</template>

<script>
import navBar from '@/components/NavBar'
import sHeader from '@/components/SimpleHeader'
import { getUserInfo } from '../service/user'
import bg_default from '@/assets/user_head_bg.png';
export default {
  components: {
    navBar,
    sHeader
  },
  data() {
    return {
      user: {},
      background_image: bg_default
    }
  },
  async mounted() {
    const { data } = await getUserInfo()
    this.user = data
  },
  methods: {
    goBack() {
      this.$router.go(-1)
    },
    goTo(r) {
      this.$router.push({ path: r })
    }
  }
}
</script>

<style lang="less" scoped>
  @import '../common/style/mixin';
  .user-box {
    text-align: center;
    background-repeat: no-repeat;
    background-size: cover;
    color: #fff;

    .user-header {
      background-repeat: no-repeat;
      background-size: cover;
      position: fixed;
      top: 0;
      left: 0;
      z-index: 10000;
      .fj();
      .wh(100%, 44px);
      line-height: 44px;
      padding: 0 10px;
      .boxSizing();
      color: #252525;
      border-bottom: 1px solid #dcdcdc;
      .user-name {
        font-size: 14px;
      }
    }
    .user-info {
      width: 94%;
      margin: 10px;
      height: 245px;
      background: linear-gradient(90deg, #050000, #0a0166);
      box-shadow: 0 2px 5px #2222d7;
      border-radius: 6px;
      margin-top: 50px;

      .user_avatar {
        padding-top: 50px;

        img {
          border: 0;
          border-radius: 80%;
          align-self: center;
        }
      }
      .info {
        position: relative;
        display: flex;
        width: 100%;
        height: 100%;
        padding: 25px 20px;
        text-align: left;
        margin-bottom: 40px;
        .boxSizing();
        img {
          .wh(60px, 60px);
          border-radius: 50%;
          margin-top: 4px;
        }
        .user-desc {
          display: flex;
          flex-direction: column;
          margin-left: 10px;
          line-height: 20px;
          font-size: 14px;
          color: #fff;
          span {
            color: #ffffff;
            font-size: 16px;
            padding: 2px 0;
          }
        }
        .account-setting {
          position: absolute;
          top: 10px;
          right: 20px;
          font-size: 13px;
          color: #000000;
          .van-icon-setting-o {
            font-size: 16px;
            vertical-align: -3px;
            margin-right: 4px;
          }
        }
      }
    }
    .user-list {
      padding: 15px 20px;
      margin-top: 20px;
      color: #000000;
      li {
        height: 50px;
        line-height: 40px;
        border-bottom: 1px solid #c3d8e2;
        display: flex;
        justify-content: space-between;
        font-size: 14px;
        .van-icon-arrow {
          margin-top: 18px;
        }
      }
    }
  }



</style>
